{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import  pandas as pd\n",
    "file = r\"P:\\public\\sqli\\sharedata\\dzh.abk\\20171229.dzh.abk.full.csv\"\n",
    "df = pd.read_csv(file, encoding=\"gbk\")\n",
    "df.rename(columns={\"BOARDNAME\" : \"ConceptSectorName\", \"TICKER\": \"Ticker\", \"BOARDTYPENAME\":\"From\"}, inplace=True)\n",
    "msk = df[\"From\"] == \"大智慧概念\"\n",
    "df = df.loc[msk, [\"ConceptSectorName\", \"Ticker\", \"From\"]]\n",
    "drop_list = list()\n",
    "agg = df.groupby(\"ConceptSectorName\").count()\n",
    "agg[\"From\"].describe()\n",
    "msk = agg[\"From\"] <= 50\n",
    "hold_list = agg.loc[msk].index.tolist()\n",
    "msk = df[\"ConceptSectorName\"].isin(hold_list)\n",
    "df = df.loc[msk]\n",
    "df.to_csv(r\"P:\\T0\\ConceptSector\\dzh.concept.csv\", index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
